import React from "react";
import { NavLink, Routes, Route } from "react-router-dom";

import "./07-style.css";

const Home = () => {
  return <div>home页面</div>;
};
const About = () => {
  return <div>about页面</div>;
};

const App = () => {
  return (
    <>
      <h2>router-v6-navLink</h2>
      <ul>
        <li>
          {/* activeClassName被删掉了 */}
          {/* isActive表示是否匹配的true或者false */}
          <NavLink
            to="/home"
            className={({ isActive }) => {
              return isActive && "select";
            }}
          >
            home
          </NavLink>
        </li>
        <li>
          <NavLink
            to="/about"
            className={({ isActive }) => {
              return isActive && "select";
            }}
          >
            about
          </NavLink>
        </li>
      </ul>

      <hr />

      <Routes>
        <Route path="/home" element={<Home />}></Route>
        <Route path="/about" element={<About />}></Route>
      </Routes>
    </>
  );
};

export default App;
